package com.liuxia8.part8.vectors;

import java.util.Vector;

/**
 * Created by weng.junjie on 2017/2/24.
 */
public class GopherVector {
    private Vector v=new Vector();
    public void addElement(Gopher e){
        v.addElement(e);
    }
    public Gopher elementAt(int index){
        return (Gopher)v.elementAt(index);
    }
    public int size(){
        return v.size();
    }

    public static void main(String[] args) {
        GopherVector gopherVector=new GopherVector();
        for(int i=0;i<3;i++){
            gopherVector.addElement(new Gopher(i));
        }
        for (int i=0;i<gopherVector.size();i++){
            GopherTrap.caughtYa(gopherVector.elementAt(i));
        }
    }
}
